package com.fanshuai2.niuke.strings;

import java.util.*;

public class IpCheck2 {
    static boolean ipIsValid(String s) {
        String[] arr = s.split("\\.");
        if (arr.length != 4) {
            return false;
        }
        for (String e : arr) {
            if (e.length() == 0 || e.length() > 3) {
                return false;
            }
            for (char ch : e.toCharArray()) {
                if (!Character.isDigit(ch)) {
                    return false;
                }
            }
        }
        return true;
    }

    static boolean maskIsValid(String s) {
        String[] arr = s.split("\\.");
        if (arr.length != 4) {
            return false;
        }
        String binary = toByteString(s);
        return binary.matches("[1]{1,}[0]{1,}");
    }

    static String toByteString(String mask) {
        StringBuilder b = new StringBuilder();

        String[] arr = mask.split("\\.");
        for (String e : arr) {
            int n = Integer.valueOf(e);
            String binary = Integer.toBinaryString(n);
            while (binary.length() < 8) {
                binary = "0" + binary;
            }
            b.append(binary);
        }
        return b.toString();
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int aNum = 0, bNum = 0, cNum = 0, dNum = 0, eNum = 0, pNum = 0, error = 0;
        while (in.hasNextLine()) {
            String line = in.nextLine();
            String[] arr = line.split("~");
            String ip = arr[0];
            String mask = arr[1];

            String[] ipArr = ip.split("\\.");
            int first = Integer.valueOf(ipArr[0]);
            int second = Integer.valueOf(ipArr[1]);
            if (first == 0 || first == 127) {
                continue;
            }
            if (!ipIsValid(ip)) {
                error++;
            } else if (!maskIsValid(mask)) {
                error++;
            } else {
                if (first >= 1 && first <= 126) {
                    aNum++;
                }
                if (first >= 128 && first <= 191) {
                    bNum++;
                }
                if (first >= 192 && first <= 223) {
                    cNum++;
                }
                if (first >= 224 && first <= 239) {
                    dNum++;
                }
                if (first >= 240 && first <= 255) {
                    eNum++;
                }

                if (first == 10 ||
                        first == 172 && second >= 16 && second <= 31 ||
                        first == 192 && second == 168) {
                    pNum++;
                }
            }
        }
        System.out.printf("%d %d %d %d %d %d %d\n", aNum, bNum, cNum,
                dNum, eNum, error, pNum);
    }
}
